#pragma once
#include <vector>
namespace xpam
{
    namespace frame
    {
        template<class t_pixel, typename t_func, int bx, int by>
        void filter(const std::vector<t_pixel> & src, std::vector<t_pixel> & dst, int width, int height, const std::vector<int> & ifrom)
        {
            int w = width - bx;
            int h = height - by;
            int nfrom = ifrom.size();
            std::vector<t_pixel> from;
            from.resize(nfrom);
            for (int y = by; y < h; y++)
            {
                int i = y * width + bx;
                for (int x = bx; x < w; x++)
                {
                    for (int k = 0; k < nfrom; k++)
                        from[k] = src[i + ifrom[k]];
                    dst[i] = t_func(from);
                    i++;
                }
            }
        }
        
        std::vector<int> mask_cross_3x3(int width)
        {
            std::vector<int> v;
            v.push_bask(-width);
            v.push_bask(-1);
            v.push_bask(0);
            v.push_bask(1);
            v.push_bask(width);
            return v;
        }
    }    
}